<template>
    <view :class="$style.page">
        <view style="height: 100%; position: relative; overflow-y: auto;">
            <PageHeader :showSearch="false">
                <view class="PAGE_TITLE">{{ appName }}</view>
            </PageHeader>

            <view :class="$style.tasks" v-if="dataRows.length > 0">
                <view :class="$style.item" v-for="(item, index) in dataRows" :key="index">
                    <view :class="$style.subName">{{ item.msgTitle }}</view>
                    <view class="m-t-20">{{ item.msgSendDate }}</view>
                    <!-- <view :class="$style.detail">
                        <view :class="$style.title">通知详情</view>
                        <view :class="$style.row">
                            <view :class="$style.label">业务场景</view>
                            <view>{{ item.sceneName }}</view>
                        </view>
                        <view :class="$style.row">
                            <view :class="$style.label">接收时间</view>
                            <view>{{ parseTime(item.createTime) }}</view>
                        </view>
                    </view> -->
                    <view class="m-t-40">
                        <button :plain="true" type="primary" @click="goNav(item)">查看详情</button>
                    </view>
                </view>
                
            </view>
        
        </view>
    </view>
</template>

<script lang="ts" setup>
    import { messageListApi } from '@/api/Message';
    import PageHeader from '@/components/PageHeader.vue'
import { isMobile } from '@/utils';
    import { ref } from 'vue';


    var pages = getCurrentPages();
    var page = pages[pages.length - 1];
    const appId = page.options.appId
    const appName = page.options.appName

    const loading = ref(true)
    
    const dataRows = ref<any[]>([])
    
   



    uni.showLoading()
    messageListApi({appId}).then(r => {
        
        if(r.data) {
            // r.data.forEach(row => {
            //     row.ids = row.ids.join(",")
            // })

            dataRows.value = r.data[0].msgList
        }
        uni.hideLoading()
        loading.value = false
    })

    function goNav(item) {
        location.href = isMobile() ? item.mobileUrl : item.pcUrl
    }



</script>

<style lang="scss" module src="./index.scss"></style>